#if !defined(TOOL_H_)
#define TOOL_H_


typedef struct _BufferInfo   
{  
	 unsigned char *pData;
   int nSize;   
   int nFlag;
	struct _BufferInfo *pNext;
}BufferInfo, *lpBufferInfo;


typedef struct _BlockInfo   
{  
	sem_t m_Semaphore;
	pthread_mutex_t m_Lock;
	BufferInfo *m_Push; 
	BufferInfo *m_Pop;   
	BufferInfo *m_pInfo;  
	unsigned char *m_pData; 
	unsigned char *m_pCurr; 
	int m_nInfoSize;  
	int m_nDataSize;
}BlockInfo, *lpBlockInfo;

int InitBlockInfoBuffer(BlockInfo *pBlockInfo,int nInfoSize,int nDataSize,unsigned char *pBuf=NULL,int nBufCount=0);
int PushBlockInfoData(BlockInfo *pBlockInfo,unsigned char *pData,int iSize, unsigned char *pFrontData = NULL, int iFrontSize =  0);
int GetCode(unsigned char *src,int count,unsigned char **pOut,int *iSize);

#endif
